<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="centre/manage/include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<!-- <div class="ibox-title">
						<h5>直播添加</h5>
					</div> -->
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="zhiboAddForm">
							<div class="form-group">
								<label class="col-sm-3 control-label">选择商品:</label>
								<div class="col-sm-6">
									<input type="hidden" name="productId" id="productId" value="">
									<input id="title" name="title" placeholder="选择商品"
										class="form-control" type="text" readonly>
								</div>
								<div class="col-sm-3">
									<button type="button" class="btn btn-primary" onclick="toSelectProduct()">
										<i class="fa fa-check"></i>选择商品
									</button>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">类型:</label>
								<div class="col-sm-8">
									<select data-placeholder="" class="form-control chosen-select"
										id="type" name="type">
										<option value="1">图文</option>
										<option value="2">视频</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">发布人昵称:</label>
									<div class="col-sm-8">
										<input id="nickname" name="nickname" class="form-control"
											type="text">
									</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">内容:</label>
								<div class="col-sm-8">
									<textarea id="content" name="content" class="form-control" /></textarea>
								</div>
							</div>

							<div class="form-group" id="imageDiv">
								<label class="col-sm-3 control-label">图片:</label>
								<div class="col-sm-6">
									<input id="images" name="images" class="form-control" type="text"
										onblur="onThumbBlur()" readonly placeholder="批量上传图片">
								</div>
								<div class="col-sm-2">
									<button class="btn btn-primary" type="button"
											onclick="selectImgs('images');">
										<i class="fa fa-check"></i>选择图片</button>
								</div>
							</div>
							<div class="form-group" id="videoDiv" style="display:none">
								<label class="col-sm-3 control-label">视频:</label>
								<div class="col-sm-6">
									<input id="videourl" name="videourl" class="form-control" type="text"
										onblur="onThumbBlur()" readonly placeholder="上传视频">
								</div>
								<div class="col-sm-2">
									<button class="btn btn-primary" type="button"
											onclick="onSelectImgBtnClick('videourl','videourl');">
										<i class="fa fa-check"></i>选择媒体文件</button>
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-8" id="imgDiv">
									<label class="col-sm-5 control-label"></label>
									<!-- <img class="img-responsive" id="categoryAddthumbImg" src=""
										style="max-width: 30%"> -->
								</div>
							</div>

							<div class="form-group text-center">
								<div class="col-sm-8 col-sm-offset-2">
									<button type="button" class="btn btn-primary" onclick="save()">
										<i class="fa fa-check"></i>提交
									</button>
									<div class="btn btn-danger" onclick="closeDow()">
										<i class="fa fa-remove"></i> 关闭
									</div>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<!-- 选择商品html部分 start -->
	<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×</button>
					<h4 class="modal-title">选择商品</h4>
				</div>
				<div class="modal-body">
					<div class="row">
						<div class="form-horizontal form-search">
							<div class="col-xs-12">
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right"
										style="padding-top:2px;">商品搜索： 
									</label>
									<div class="col-sm-9">
										<input type="text" name="mgkey" id="mgkey"
											placeholder="输入商品ID以及名称搜索"
											class="col-xs-10 col-sm-7"> 
										<span class="input-group-btn">
											<button onclick="get_goods()" type="button"
												class="btn btn-xs btn-primary">搜索
											</button>
										</span>
									</div>
								</div>
								<div class="space-4"></div>
							</div>
						</div>
					</div>

					<div class="row">
						<div class="col-xs-12">
							<div>
								<input name="p" id="p" value="1" type="hidden">
								<div class="table-responsive">
									<table class="table table-striped table-bordered table-hover"
										id="dynamic-table">
										<thead>
											<tr>
												<th class="hidden-xs" style="text-align: center">ID</th>
												<th>商品图片</th>
												<th>商品名称</th>
												<th style="border-right: #CCC solid 1px;">操作</th>
											</tr>
										</thead>
										<tbody id="ajax-data">
											<tr>
												<td class="hidden-xs" colspan="5" align="center">请搜索要选择的商品</td>
											</tr>
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- 选择商品html部分 end -->
	<div th:include="centre/manage/include::footer"></div>
	<script type="text/javascript" src="/js/appjs/product/zhibo/add.js"></script>
	<script type="text/javascript">
		function closeDow() {
			var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
			parent.layer.close(index);
		}
	</script>
</body>
</html>
